package com.cskaoyan.dbutils;

import com.cskaoyan.others.DruidUtils;
import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.handlers.MapListHandler;

import java.sql.SQLException;
import java.util.List;
import java.util.Map;

/**
 * 创建日期: 2021/11/25 16:44
 *
 * @author ciggar
 */
public class MapListHandlerDemo {

    public static void main(String[] args) throws SQLException {

        QueryRunner queryRunner = new QueryRunner(DruidUtils.getDataSource());

        List<Map<String, Object>> mapList = queryRunner.query("select id,name,role from account", new MapListHandler());

        for (Map<String, Object> map : mapList) {

            System.out.println(map);

        }

    }
}
